import logging
import os
import sys

path = "./"


def get_file_with_path(path):
    f_list = os.listdir(path)
    logging.warning(f"{f_list}")

    only_file_list = []

    for f in f_list:
        full_path = os.path.join(path, f)  # ����·��

        if os.path.isfile(full_path):
            only_file_list.append(full_path)
        elif os.path.isdir(full_path):
            only_file_list.extend(get_file_with_path(full_path))
        else:
            logging.warning(f"{full_path}既不是文件也不是目录~")

        logging.warning(f"{only_file_list}")
        return only_file_list


def my_sum():
    print("\n这是一个命令行的算术器，可以完成任意的算数运算！")
    print("你需要输入两个数字")

    print("=" * 20)

    x = input("请输入第一个数字：")
    y = input("请输入第二个数字：")

    # 捕获异常
    if not x or not y:
        print("对不起，请输入两个数字！")
        return

    try:
        if sys.argv[1] == "sum":
            print("两数相加的结果为：", int(x) + int(y))
        elif sys.argv[1] == "sub":
            print("两数相减的结果为：", int(x) - int(y))
        elif sys.argv[1] == "mul":
            print("两数相乘的结果为：", int(x) * int(y))
        elif sys.argv[1] == "div":
            print("两数相除的结果为：", int(x) / int(y))
        else:
            print("对不起，请输入正确的运算符！")
    except ValueError:
        print("对不起，请输入数字！")
        return
